package rotation;

import geo.obj.PhiObject;
import geo.obj.Triangle;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Polygon;
import java.util.ArrayList;

import javax.swing.JPanel;

public class DP extends JPanel {
	PhiObject p;
	Polygon pp;
	
	
	private static final long serialVersionUID = 1L;

	/**
	 * This is the default constructor
	 */
	public DP() {
		super();
		initialize();
	}
	
	private void initialize() {
		this.setSize(300, 200);
		double x[] = {0, 50, 50, 0};
		double y[] = {0, 0 , 50, 50};
		p = new PhiObject(x, y, 30.0, 30.0, 0.0, "ololo");
		System.out.println(p.trg_test());
	 }
	
	public void paint(Graphics g){
		p.trg();
		ArrayList<Triangle> t = p.getTrianglelist();
		
		g.setColor(Color.GREEN);
		g.fillPolygon(t.get(0).getIntX(), t.get(0).getIntY(), 3);
		g.setColor(Color.RED);
		g.fillPolygon(t.get(1).getIntX(), t.get(1).getIntY(), 3);
	}
	
	public void rotate(double a){
		p.rotate(a);
		repaint();
	}

}
